import React from 'react'
import { NavBar, TabBar } from 'antd-mobile'
import { tabberRouter } from '../router'
import { useLocation, useNavigate } from 'react-router-dom'
import styles from './index.module.css'


const Tabber = () => {
  const { pathname } = useLocation()
  const navigate=useNavigate()
  const setRouteActive= (value) => {
    navigate(value)
  }
  return (
    <div className={styles.tabber}>
      <div className={styles.tabberContent}>
      <TabBar activeKey={pathname} onChange={value => setRouteActive(value)}>
      {tabberRouter.map(item => (
        <TabBar.Item key={item.path} icon={item.meta.icon} title={item.meta.title} />
      ))}
    </TabBar>
      </div>
    </div>
  )
}

export default Tabber
